UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xC27O3Sj2+A647piRbSsrMtdUc1MoWZLU+53ZJ5odbA='
WHERE
key_id = '9f5cb90f96189abe46ad03e4505d5113296368f77bb6d67f2fd71090b08ef4d7'
AND (
token = 'xC27O3Sj2+A647piRbSsrMtdUc1MoWZLU+53ZJ5odbA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)