UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ka2cNwxzQSYrfdWCEVa/c6dlsOiprAxETp9OnLYxyMM='
WHERE
key_id = 'f498ed2c5b91604f65e55ee4cf801e896c9232e0bf14c9185610720a76543d6c'
AND (
token = 'Ka2cNwxzQSYrfdWCEVa/c6dlsOiprAxETp9OnLYxyMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)