UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4gCP+1efkT85jBGuQsqrJuNkNrEUnlnx4fgQNutd2NU=' 
WHERE 
  key_id = 'c28ddb0246e59afc021e73779a61b2905d3c1dd0fe2c90a31d6c26166c05cf00' 
  AND (
    token = '4gCP+1efkT85jBGuQsqrJuNkNrEUnlnx4fgQNutd2NU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046