UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/kVpKyFU2Q+gPOC/bFunqhOmgQz+9Ks9sbOoSMN9a2o='
WHERE
key_id = 'b766894ff2ab904aa647667244882e1c688cb8dd06102aa5ef19dce75007aa43'
AND (
token = '/kVpKyFU2Q+gPOC/bFunqhOmgQz+9Ks9sbOoSMN9a2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)