UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6157veQBxh0T49Cqrex7zg1UM9ZF3vb0Bflv4hqsZ8M='
WHERE
key_id = 'e6ae1d2ededffc6e5a70e7abd57eb2640b52b56a10366162a036f8ec84458d9b'
AND (
token = '6157veQBxh0T49Cqrex7zg1UM9ZF3vb0Bflv4hqsZ8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)