UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+4AZXoAO8ZafbWoD6CoWwqKpTOi784McxW02PZvcf68='
WHERE
key_id = '2f2c3cc7c87889fac4979f1eda4b74f31bbda301ae0854de2192375a14d5847e'
AND (
token = '+4AZXoAO8ZafbWoD6CoWwqKpTOi784McxW02PZvcf68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)