UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aQY9NU25HUK10gJx3KMYQAstw6V1nnoD84npmHUgMKs='
WHERE
key_id = '0c66e653ce0d48531c71ca4e52098cd9c066600670d5e0fd3f55df9acde1f4c1'
AND (
token = 'aQY9NU25HUK10gJx3KMYQAstw6V1nnoD84npmHUgMKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)