UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w5TpFmZ1sDQ8NGpeGoI2qCJGyPdZAYfbqwJfh8XISHU='
WHERE
key_id = '9ed86e79df6eb1bd0673e242e2f1c4651345043b6a90b808846eb5196b34211a'
AND (
token = 'w5TpFmZ1sDQ8NGpeGoI2qCJGyPdZAYfbqwJfh8XISHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)