UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uAg5TV906kS23FJKxzzsQ4+GHd8Jtfnx9UZtUtYhPKE=' 
WHERE 
  key_id = 'caaed7a07670d68fff853db367672f9abed42c53e1b5eb55d51097589405cfea' 
  AND (
    token = 'uAg5TV906kS23FJKxzzsQ4+GHd8Jtfnx9UZtUtYhPKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037