UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f1umjmfWe1AUIHEWYvdGK7cEResZPkENXexhY78PGGI=' 
WHERE 
  key_id = '1d292a46eac2549876ca3e7637926b6b1debdb0ead86ec2d3eaaf1da39f3d623' 
  AND (
    token = 'f1umjmfWe1AUIHEWYvdGK7cEResZPkENXexhY78PGGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028