UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A+GWJnc0qVgjjAIUuos1m+VqdTVhKIp5qz7+JltmS6o=' 
WHERE 
  key_id = 'afbb03daa6341bd31da1cbbaf731664137f18192e311435764c0c9982a407859' 
  AND (
    token = 'A+GWJnc0qVgjjAIUuos1m+VqdTVhKIp5qz7+JltmS6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034