UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm1a7veAfCc8WI7o0X0/oMjRyRtrPADxge/026Bic8mc='
WHERE
key_id = '9e0901bbd4b20d56f365df0577df850a14db4cc6fbe518a35c511d8cde8df6d0'
AND (
token = 'm1a7veAfCc8WI7o0X0/oMjRyRtrPADxge/026Bic8mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)