UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'St2y+SWmMOSfZf4yTufbVkhaxlMetEuJP48ET8ImfYQ='
WHERE
key_id = 'bf07790a9f264e2d9186d31387ea0ba3edea7ba92c6e8b1fe123da80fa950cf0'
AND (
token = 'St2y+SWmMOSfZf4yTufbVkhaxlMetEuJP48ET8ImfYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)