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