UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ifgIK6U/Lj3E0PCJ/qReSC1ax+CCEe2L70kh2/5UwL8='
WHERE
key_id = '3c6fb1897db2dbb45be0b6c357e766c9c51f453c2eb230a3d0294e017693001f'
AND (
token = 'ifgIK6U/Lj3E0PCJ/qReSC1ax+CCEe2L70kh2/5UwL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)