UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+DhBbmEREakfFr3dI09eigiI0qd05xiBtpxq2pX2eI=' 
WHERE 
  key_id = '735165b2df8612d47720748407444b407196c4e8ac3814b3c15f9318b24f8bb1' 
  AND (
    token = 'w+DhBbmEREakfFr3dI09eigiI0qd05xiBtpxq2pX2eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026