UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kGRb8i2bJVuI45cuv94Qb7C3bxjOnlbOqeEKfYDPE5g='
WHERE
key_id = '347d8ac21f2252e2da6e78655e55911836c38b8918f1112da7a7edef34f665e6'
AND (
token = 'kGRb8i2bJVuI45cuv94Qb7C3bxjOnlbOqeEKfYDPE5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)