UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'facEMtuL0Xeg5dtvSWLiqJN0XwbidFWRIOrYdS6oTTA='
WHERE
key_id = 'a1da4191716371472ec8b3527c827940efc37e8b028c49a1b21b5ba272f57b71'
AND (
token = 'facEMtuL0Xeg5dtvSWLiqJN0XwbidFWRIOrYdS6oTTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)