UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LYv9WZd9tUVma3BObmntSAf4YdAKhuLOle3ufsO3K2s='
WHERE
key_id = '9b1e82b32bc6173b7e6216c5509ea8c29309094f94b9d061df91966a713fb669'
AND (
token = 'LYv9WZd9tUVma3BObmntSAf4YdAKhuLOle3ufsO3K2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)