UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RUj6MdtaW1azOXpiJlzEEuuWUQJVQW36Wn7+ZB1qUWc=' 
WHERE 
  key_id = 'd9f4d00681528df603f7b118758bd58e8677794bbb71872b77249764663c6851' 
  AND (
    token = 'RUj6MdtaW1azOXpiJlzEEuuWUQJVQW36Wn7+ZB1qUWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019