UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UgfTVPLQAGNXyEGw/YCGOrcz1h+kGfkTtkrhB6ZqbOs=' 
WHERE 
  key_id = '487085e31ab06d9807107dbecc0d16c5c8582a2be565a896fe2b21a70f6cf1c8' 
  AND (
    token = 'UgfTVPLQAGNXyEGw/YCGOrcz1h+kGfkTtkrhB6ZqbOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027