UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qw1lcktwaaEU/8NjvMgV+HPasoh5thum8z3rIvsfiK8=' 
WHERE 
  key_id = '64a4c31ab50655269d8a4eb1b731d014f32ac3f35fc04aafd61f235692e5e2e7' 
  AND (
    token = 'Qw1lcktwaaEU/8NjvMgV+HPasoh5thum8z3rIvsfiK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040