UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oaIKLNQ2UEnh1oGAfmDvJlPay4FbdQm6hWFmyVIN9Og='
WHERE
key_id = 'a8ec7a1a1f306d1b89f869924c4d6f0c8ee11c378a9b8e3042c5d6349d8a801a'
AND (
token = 'oaIKLNQ2UEnh1oGAfmDvJlPay4FbdQm6hWFmyVIN9Og='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)