UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZKNBfQlv7Zv9q/jkFEBzU9wokdDQ2T75lNITeI48FMo='
WHERE
key_id = '1248f86b68eb471cc53174580ffc2c33dedf6ec7289084931b2945f9ce9b4d19'
AND (
token = 'ZKNBfQlv7Zv9q/jkFEBzU9wokdDQ2T75lNITeI48FMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)