UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v2/6AVDkAC1b94akKiD/3V/ag0le4B90y6YlA10kjtc='
WHERE
key_id = '9515d77c0e67e69b6cf728ca7cd341131972f2b4e733e722b6f1b1b32abf97d3'
AND (
token = 'v2/6AVDkAC1b94akKiD/3V/ag0le4B90y6YlA10kjtc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)