UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VERd8vJ0QfQzoKyOTHjwNJFanI0F445PehWm6oOH2eY=' 
WHERE 
  key_id = '76323faab2a77607963b5fb303e7cb57009511d56a06ca7d794784c931e6915c' 
  AND (
    token = 'VERd8vJ0QfQzoKyOTHjwNJFanI0F445PehWm6oOH2eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054