UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bdEC8zVxwuGFczlG4Z5j0bJhs6eBUvJxyigNJGhIgP0='
WHERE
key_id = '9a21959158730b2dbd6b32061b2e430f6cb062c12dc3e6663b1fcf565035a82e'
AND (
token = 'bdEC8zVxwuGFczlG4Z5j0bJhs6eBUvJxyigNJGhIgP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)