UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'evay5RZEwrFiwGmjE+v+LEc7BQVEs7eJtdeGUea1aOY=' 
WHERE 
  key_id = '40a650b4e7c0d424fdbca753750ece090368b903595dc98d40da6a9d91af7b9e' 
  AND (
    token = 'evay5RZEwrFiwGmjE+v+LEc7BQVEs7eJtdeGUea1aOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037