UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIjeqpxxY1KGKnBH8B9S0FuCUw/B99rN+WybKUCZ6bM='
WHERE
key_id = '6985d781ca6ab6048453567a1a1ebf8bd8a2bb3dc3e7f171720bb3c10aa59340'
AND (
token = 'dIjeqpxxY1KGKnBH8B9S0FuCUw/B99rN+WybKUCZ6bM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)