UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L20xBvsqTGh+Zfe41mejgDPcTSAGjOr//VWrDQeqr8Y=' 
WHERE 
  key_id = 'd389149a002ac0ea2d985fbd20def12d53be7703fd768bd654efb7c2d7f4971d' 
  AND (
    token = 'L20xBvsqTGh+Zfe41mejgDPcTSAGjOr//VWrDQeqr8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022