UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jHiM4bc1YnqbC/zlq8W0htBEn7mC8gQbZzkOA8cQO/w=' 
WHERE 
  key_id = '1032b64d13050e084804a7a4fdd0ab167836b5f554ad2553d27201c6521dabae' 
  AND (
    token = 'jHiM4bc1YnqbC/zlq8W0htBEn7mC8gQbZzkOA8cQO/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032