UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f3FIY07Ua6J11+6kNriUsM1P5hLCG9/KN2Jz9ItUu7s=' 
WHERE 
  key_id = 'b4c986686f3d75c88beccbc0c1072ef6c1a32d2bc80ca9128c5c1ef80aa020c8' 
  AND (
    token = 'f3FIY07Ua6J11+6kNriUsM1P5hLCG9/KN2Jz9ItUu7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044