UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PASc81yn0mWfkEMWKAmhKtSQva6+V1L+x/J2vlLgMcs=' 
WHERE 
  key_id = '4127e0ab89bf205c079e0707e7815dfd2e87ec9d1fbd51cfd7f812d5ff8eacde' 
  AND (
    token = 'PASc81yn0mWfkEMWKAmhKtSQva6+V1L+x/J2vlLgMcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027