UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pBLH0HJ+5WLU4fYddPjO2mgOswCuco1gACGbA72ag18='
WHERE
key_id = '1f50f46bd1033198d9d8432a51bee7846a5a9a46320aa65e911a8972f9257dae'
AND (
token = 'pBLH0HJ+5WLU4fYddPjO2mgOswCuco1gACGbA72ag18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)