UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q0vzJv7cHobB08qhIQDHPYPJfQnFEuQkLElC1A+naA8='
WHERE
key_id = 'a317986ebcf45b437d6440f3ec4848ad13884a55faaf47433a1a02dc979e23ec'
AND (
token = 'Q0vzJv7cHobB08qhIQDHPYPJfQnFEuQkLElC1A+naA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)