UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPW/FOg49U2JTRmKao6BlJlT76M2yuTH2d9MTi8S1oQ=' 
WHERE 
  key_id = 'df311440460940154f5be855d198fe857fcbbf318249b5601c1d1cb34182e319' 
  AND (
    token = 'xPW/FOg49U2JTRmKao6BlJlT76M2yuTH2d9MTi8S1oQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030