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