UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '66rDtSAN1Epl2xd84AsFrj+xIz3Yiae3k1+DYcmBDS8='
WHERE
key_id = 'c6abac0322d737e88ebf024687c05968386d094b719346a597ab7a4c7af5baa4'
AND (
token = '66rDtSAN1Epl2xd84AsFrj+xIz3Yiae3k1+DYcmBDS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)