UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fMvqHv2fGblhFGiOlNBT4DUJ4JMoVRnOqqWGtKGetCk=' 
WHERE 
  key_id = 'd7cf68396100560478ba468a64c7bca25c45d12a6729f16f0fde7857b9280f5e' 
  AND (
    token = 'fMvqHv2fGblhFGiOlNBT4DUJ4JMoVRnOqqWGtKGetCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029