UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YtPq8WxT9UFziLr6qpSoHm1HhJAP4A+AimUZpzY44jU=' 
WHERE 
  key_id = '1f3362e01b108d46b4f4f73c930307af7558e792fbdf65fa1cb5e046044732c5' 
  AND (
    token = 'YtPq8WxT9UFziLr6qpSoHm1HhJAP4A+AimUZpzY44jU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041