UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NNKCjkqqxU2XdTI10wMv04VcJGwoadOzBoZcEeOKxzQ='
WHERE
key_id = '0ea47d221613fe0278a176520b21ea9a254faa0872f1f4c4355e34ddceb20974'
AND (
token = 'NNKCjkqqxU2XdTI10wMv04VcJGwoadOzBoZcEeOKxzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)