UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8P1MY01Lvv0J17EKQmeFnvobhlUEh9j6Q8F9TOfzz0c=' 
WHERE 
  key_id = 'b3d07046c3bb006ab3010ab4e2d75b6d15c77f408e739609f87c76b6f8e4fb69' 
  AND (
    token = '8P1MY01Lvv0J17EKQmeFnvobhlUEh9j6Q8F9TOfzz0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046